package com.a3dweijing.wetouch2.adapter;

import android.content.Context;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import com.a3dweijing.wetouch2.Common.listview.CommonListviewAdapter;
import com.a3dweijing.wetouch2.Common.listview.ViewHolderListview;
import com.a3dweijing.wetouch2.R;
import com.a3dweijing.wetouch2.Util.GlideUtil;
import com.a3dweijing.wetouch2.bean.CardListMsg;

import java.util.List;

/**
 * Created by Administrator on 2018/4/10.
 */

public class CardListAdapter extends CommonListviewAdapter {
    public CardListAdapter(Context context, List<CardListMsg.BankcardListBean> list, int layoutId) {
        super(context, list, layoutId);
    }

    @Override
    public void convert(ViewHolderListview holder, Object o, int position) {
        CardListMsg.BankcardListBean listBean= (CardListMsg.BankcardListBean) o;
        ImageView cardImag = holder.getView(R.id.card_img);
        TextView cardName = holder.getView(R.id.card_bank);
        TextView cardType = holder.getView(R.id.card_type);
        TextView cardNumber = holder.getView(R.id.card_number);

        String imagUrl = listBean.getBankimage();
        String s = GlideUtil.getInstance().checkUrl(imagUrl);
        GlideUtil.getInstance().showByCircle(context,s,cardImag);
        cardName.setText(listBean.getBankname());
        cardType.setText(listBean.getCardtype());

        String bankenumber = String.valueOf(listBean.getBankcard());
        char[] arrN = bankenumber.toCharArray();
        for (int i = 0;i<arrN.length;i++){
                arrN[i]='*';
            if (i>=arrN.length-5){
                break;
            }
        }
        String card = String.valueOf(arrN);
        cardNumber.setText(card);

    }
}
